package com.pope945.mypanel;
import com.cloudgarden.layout.AnchorConstraint;
import com.cloudgarden.layout.AnchorLayout;

import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;

import javax.swing.JButton;

import javax.swing.WindowConstants;
import org.jdesktop.application.Application;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;

import com.util.ReadConfig;
import com.util.cmd.*;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class EastPanel extends javax.swing.JPanel implements ActionListener{
	private JPanel jPanel1;
	private JButton jButton1;
	private JButton jButton2;

	private JPanel jPanel2;
	
	private JPanel jPanel3;
	
	private BackGroundPane jp_rdzs;
	private BackGroundPane jp_cyrj;

	/**
	* Auto-generated main method to display this 
	* JPanel inside a new JFrame.
	*/
	public static void main(String[] args) {
		JFrame frame = new JFrame();
		frame.getContentPane().add(new EastPanel());
		frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		frame.pack();
		frame.setVisible(true);
	}
	
	public EastPanel() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setPreferredSize(new Dimension(282, 451));
			AnchorLayout thisLayout = new AnchorLayout();
			this.setLayout(thisLayout);
			this.setName("this");
			{
				String oftenusesoft=ReadConfig.readValue("config.ini","url.oftenusesoft");
				jPanel2 = new ComBrowserUrlPanel(oftenusesoft);
				this.add(jPanel2, new AnchorConstraint(680, 1001, 1001, 1, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
				jPanel2.setPreferredSize(new java.awt.Dimension(276, 147));
				
			}
			{
				jp_cyrj = new BackGroundPane();
				AnchorLayout jp_cyrjLayout = new AnchorLayout();
				jp_cyrj.setLayout(jp_cyrjLayout);

				this.add(jp_cyrj, new AnchorConstraint(621, 1001, 679, 1, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
				jp_cyrj.setPreferredSize(new java.awt.Dimension(282, 26));
				jp_cyrj.setImageIcon(new ImageIcon(this.getClass().getResource("/icon/bar/diannaochangyong.jpg")));
			}
			{
				String hotav=ReadConfig.readValue("config.ini","url.hotav");
				
				jPanel3 = new  ComBrowserUrlPanel(hotav);
				this.add(jPanel3, new AnchorConstraint(317, 1005, 623, 1, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
				jPanel3.setPreferredSize(new java.awt.Dimension(277, 140));
			}
			{
				String freeAvUrl=ReadConfig.readValue("config.ini","url.freeav");
				jPanel1 = new ComBrowserUrlPanel(freeAvUrl);
				this.add(jPanel1, new AnchorConstraint(1, 1001, 258, 1, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
				jPanel1.setPreferredSize(new java.awt.Dimension(276, 118));
			}
			{
				jp_rdzs = new BackGroundPane();
				jp_cyrj.setOpaque(false);
				{
					jButton2 = new JButton();
					jp_cyrj.add(jButton2, new AnchorConstraint(92, 941, 944, 810, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
					jButton2.setIcon(new ImageIcon(this.getClass().getResource("/icon/bar/more.jpg"))); 
					jButton2.setPreferredSize(new java.awt.Dimension(37, 23));
				}
				AnchorLayout jp_rdzsLayout = new AnchorLayout();
				jp_rdzs.setLayout(jp_rdzsLayout);
				this.add(jp_rdzs, new AnchorConstraint(260, 1001, 318, 1, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
				jp_rdzs.setPreferredSize(new java.awt.Dimension(282, 26));
				jp_rdzs.setImageIcon(new ImageIcon(this.getClass().getResource("/icon/bar/rdzs.jpg")));
				
				{
					jButton1 = new JButton();
					jp_rdzs.add(jButton1, new AnchorConstraint(57, 934, 1057, 810, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
					jButton1.setIcon(new ImageIcon(this.getClass().getResource("/icon/bar/more.jpg"))); 
					
					//jButton1.setBorderPainted(false);
					
					jButton1.setPreferredSize(new java.awt.Dimension(35, 26));
				}

			}
			jButton1.addActionListener(this);
			jButton2.addActionListener(this);
			
			Application.getInstance().getContext().getResourceMap(getClass()).injectComponents(this);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public void actionPerformed(ActionEvent e) {
		 if(e.getSource()==jButton1)
	        {
	           MyCMD.openUrl("http://www.baidu.com");
	        }
	        else if(e.getSource()==jButton2){
	        	MyCMD.openUrl("http://www.baidu.com");
	        }
		
	}

}
